Skip to content

MkIFrame

Show source on GitHub

Node for embedding an IFrame.

Example: With caption

Jinja

{{ "https://phil65.github.io/mknodes/" | MkIFrame(width=600, height=800) }}

Python

MkIFrame('https://phil65.github.io/mknodes/', width=600, height=800)

<iframe width="600" height="800" src="https://phil65.github.io/mknodes/"></iframe>
<iframe width="600" height="800" src="https://phil65.github.io/mknodes/"></iframe>

Bases: MkTemplate

__init__

__init__(url: str, *, width: int = 300, height: int = 150, **kwargs: Any)

Parameters:

Name Type Description Default
url str

Url to display in a frame

required
width int

width of frame in pixels

300
height int

height of frame in pixels

150
kwargs Any

Keyword arguments passed to parent

{}
graph TD
  94721311915904["mkiframe.MkIFrame"]
  94721308869584["mktemplate.MkTemplate"]
  94721311697232["mkcontainer.MkContainer"]
  94721308848336["mknode.MkNode"]
  94721311766592["node.Node"]
  140564252373184["builtins.object"]
  94721308869584 --> 94721311915904
  94721311697232 --> 94721308869584
  94721308848336 --> 94721311697232
  94721311766592 --> 94721308848336
  140564252373184 --> 94721311766592
/home/runner/work/mknodes/mknodes/mknodes/basenodes/mkiframe/metadata.toml
[metadata]
icon = "mdi:web-box"
name = "MkIFrame"

[examples.with_caption]
title = "With caption"
jinja = """
{{ "https://phil65.github.io/mknodes/" | MkIFrame(width=600, height=800) }}
"""

[output.html]
template = """
<iframe width="{{ node.width }}" height="{{ node.height }}" src="{{ node.url }}"></iframe>
"""
mknodes.basenodes.mkiframe.MkIFrame
class MkIFrame(mktemplate.MkTemplate):
    """Node for embedding an IFrame."""

    ICON = "material/web-box"

    def __init__(
        self,
        url: str,
        *,
        width: int = 300,
        height: int = 150,
        **kwargs: Any,
    ):
        """Constructor.

        Args:
            url: Url to display in a frame
            width: width of frame in pixels
            height: height of frame in pixels
            kwargs: Keyword arguments passed to parent
        """
        super().__init__("output/html/template", **kwargs)
        self.url = url
        self.width = width
        self.height = height